<%-- 
    Document   : feedback
    Created on : Nov 25, 2013, 3:30:10 PM
    Author     : Tùng
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <link type="text/css" href="css/reg.css" rel="stylesheet">
        <link type="text/css" href="css/bootstrap.css" rel="stylesheet">
        <link type="text/css" href="css/index.css" rel="stylesheet">
        <link type="text/css" href="css/table.css" rel="stylesheet">
        <script type="text/javascript" src="js/table.js"></script>
        <script type="text/javascript" src="js/modernizr.min.js"></script>
        <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.10.3.custom.min.js"></script>
        <script type="text/javascript" src="js/raphael-min.js"></script>
        <script type="text/javascript" src="js/underscore-min.js"></script>
        <script type="text/javascript" src="js/backbone-min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <script type="text/javascript" src="js/transition.js"></script>
        <script type="text/javascript" src="js/home.js"></script>
        <title>Feedback Page</title>
    </head>
    <body>
        <div id="main1">
            <div id="fixed-header" class="navbar-fixed-top row" style="width: 100%">
                <div id="menu" class="row">
                    <div id="menu-inner">
                        <div id="messages"></div>
                        <div id="menu-left" class="col-5">
                            <div id="dd-left" class="col-1 text-left">
                                <a data-toggle="dropdown" style="margin-top:20px" class="btn btn-disabled dropdown-toggle"><i class="icon-menu"></i></a>
                                <ul aria-labelledby="dLabel" role="menu" class="dropdown-menu">
                                    <li class="caret-up"></li>
                                    <c:if test="${empty sessionScope.ACCOUNT}">
                                        <li><a href="home.jsp#features">How It Works</a></li>
                                        <li><a href="index.jsp">Search Products</a></li>
                                        <li><a href="FeedbackController?btAction=ShowFeedback">Feedback</a></li>
                                        <li><a href="register.jsp">Sign Up</a></li>
                                        <li>______________________</li>
                                        <li><a href="login.jsp">Login</a></li>
                                    </c:if>
                                    <c:if test="${not empty sessionScope.ACCOUNT}">
                                        <li><a href="home.jsp#features">How It Works</a></li>
                                        <li> <a href="CollectionController?btAction=LoadAllCollection">Collection</a></li>
                                        <li><a href="index.jsp">Search Products</a></li>
                                        <li><a href="ManageProductController?btAction=ShowTrackedProduct">Your Products</a></li>
                                        <li><a href="FeedbackController?btAction=ShowFeedback">Feedback</a></li>
                                        <li>______________________</li>
                                        <li> &nbsp;&nbsp;&nbsp;Member System</li>
                                    </c:if>
                                </ul>
                            </div>
                            <div class="col-2 hiw">
                                <a href="home.jsp">Home</a>
                            </div>
                        </div>
                        <div class="col-2 text-center">
                            <img src="Images/PRTS.png" style="height: 80px"/>
                        </div>
                        <div id="menu-right" class="col-5">
                            <c:if test="${empty sessionScope.ACCOUNT}">
                                <div id="dd-right">
                                    <a href="login.jsp">
                                        Sign Up / Login
                                    </a>
                                </div>
                            </c:if>

                            <c:if test="${not empty sessionScope.ACCOUNT}">
                                <div id="dd-right">

                                    <a href="#" data-toggle="dropdown" class="dropdown-toggle">
                                        <span id="username-outer">
                                            <span id="username">${sessionScope.ACCOUNT.emailAddress}
                                            </span>
                                        </span>
                                        <span class="caret"></span>
                                    </a>
                                    <ul aria-labelledby="dLabel" role="menu" class="dropdown-menu">
                                        <li class="caret-up"></li>
                                        <li>
                                            <a id="profile" href="AccountController?action=updateAccountDetail">
                                                Account Preferences
                                            </a>
                                        </li>
                                        <c:if test="${sessionScope.ACCOUNT.role.roleID != 3}">
                                            <li>
                                                <a href="AdminController?btAction=LoadPage">Admin System</a>
                                            </li>
                                        </c:if>
                                        <li>
                                            <a id="history" href="MessageController?btAction=LoadReceivedMessage">
                                                Message
                                            </a>
                                        </li>
                                        <li>
                                            <a id="logout" href="HomeController?btAction=logout">
                                                Logout
                                            </a>
                                        </li>
                                    </ul>

                                </div>
                                <div class="pull-right ">
                                    <a href="ManageProductController?btAction=ShowTrackedProduct">My Finds</a>
                                </div>
                            </c:if>
                        </div>
                    </div>
                </div>
            </div>

            <div id="content-wrapper" style="margin-top: 100px;">
                <div class="row products private-finds">
                    <div class="grid-container" style="width: 96%;">
                        <ul class="col-12 grid-view" style="width: 100%">
                            <br/>
                            <c:if test="${not empty sessionScope.ACCOUNT}">
                                <form method="post" action="FeedbackController">
                                    <table class="example table-hover">
                                        <thead>
                                            <tr align="center">
                                                <th colspan="2" align="center"> Feedback</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td width="15%"></td>
                                                <td width="85%"><textarea rows="8" placeholder="Enter your feedback here" name="txtFeedback" id="txtFeedback"></textarea></td>
                                            </tr>
                                        </tbody>
                                        <tfoot>

                                            <tr>
                                                <td colspan="2" align="right">
                                                    <button name="btAction" type="submit" class="btn-large" value="sendFeedback"
                                                            onclick="if (txtFeedback.value=='') {
                                                                alert('Please fill in feedback before sending!!!');
                                                                return false;
                                                            }">&nbsp;&nbsp;Send&nbsp;&nbsp;</button>
                                                    <button name="action" type="reset" class="btn-large" value="Clear"
                                                            >&nbsp;&nbsp;Clear&nbsp;&nbsp;</button>
                                                </td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </form>
                            </c:if>
                            <c:if test="${empty sessionScope.ACCOUNT}">
                                <form method="post" action="FeedbackController">
                                    <table class="example table-hover">
                                        <thead>
                                            <tr align="center">
                                                <th colspan="2" align="center"> Feedback</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td width="150"></td>
                                                <td width="950"><textarea rows="8" placeholder="Please login to send us feedback" disabled="disabled"></textarea></td>
                                            </tr>
                                        </tbody>
                                        <tfoot>

                                            <tr>
                                                <td colspan="2" align="right">
                                                    <button name="btAction" type="submit" class="btn-large" value="sendFeedback"
                                                            disabled="disabled">&nbsp;&nbsp;Send&nbsp;&nbsp;</button>
                                                    <button name="action" type="reset" class="btn-large" value="Clear" disabled="disabled"
                                                            >&nbsp;&nbsp;Clear&nbsp;&nbsp;</button>
                                                </td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </form>
                            </c:if>
                            <br/>
                            <h3>${CREATEFEEDSUC}${DELETEFEEDSUC}</h3>
                            <h3 style="color:red">${CREATEFEEDERR}${DELETEFEEDERR}</h3>

                            <br/> <br/>
                            <c:if test="${not empty sessionScope.ALLFEEDBACK}">
                                <table class="table table-hover example table-autosort table-autofilter table-autopage:10 table-stripeclass:alternate table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount" >
                                    <thead>
                                        <tr align="center">
                                            <th colspan="5" align="center"> All feedbacks about our system</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <c:forEach var="rows" items="${sessionScope.ALLFEEDBACK}">
                                            <tr>
                                                <td width="20"></td>
                                                <td width="20"></td>
                                                <td width="1080"><textarea rows="8" disabled="disabled">${rows.feedbackBody}</textarea></td>
                                                <td width="20"></td>
                                                <td width="20"></td>
                                            </tr>
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td align="right">commented by <font color="green">${rows.account.emailAddress}</font> on <font color="green">${rows.feedbackDate}</font></td>
                                                <td colspan="2" align="center">
                                                    <c:if test="${not empty sessionScope.ACCOUNT}">
                                                        <c:url var="delete" value="FeedbackController">
                                                            <c:param name="btAction" value="deleteFeedback"/>
                                                            <c:param name="feedbackID" value="${rows.feedbackID}"/>
                                                        </c:url>
                                                        <c:if test="${sessionScope.ACCOUNT.role.roleID != 3}">
                                                            <a href="${delete}" onclick="return confirm('Do you want to delete this feedback?');"><img src="Images/trash.png" width="20" height="20"/></a>
                                                            </c:if>
                                                        </c:if>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td align="left" class="table-page:first"
                                                style="cursor: pointer;"><img src="Images/first.png" width="20" height="20"/></td>
                                            <td align="left" class="table-page:previous"
                                                style="cursor: pointer;"><img src="Images/previous.png" width="20" height="20"/></td>
                                            <td style="text-align: center;">Page <span
                                                    id="t1page"></span>&nbsp;of <span id="t1pages"></span>
                                            </td>
                                            <td align="right" class="table-page:next"
                                                style="cursor: pointer;"><img src="Images/next.png" width="20" height="20"/></td>
                                            <td align="right" class="table-page:last" style="cursor: pointer;"><img src="Images/last.png" width="20" height="20"/></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </c:if>
                            <c:if test="${empty sessionScope.ALLFEEDBACK}">
                                <h3 style="color: red">Sorry! Our website don't have any feedback</h3>
                            </c:if>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <% session.removeAttribute("CREATEFEEDSUC");%>
        <% session.removeAttribute("DELETEFEEDSUC");%>
        <% session.removeAttribute("CREATEFEEDERR");%>
        <% session.removeAttribute("DELETEFEEDERR");%>
    </body>
</html>